package cn.gson.springboot.model.service;

import cn.gson.springboot.model.dao.SolutionDao;
import cn.gson.springboot.model.mapper.SolutionMapper;
import cn.gson.springboot.model.pojos.Solution;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class SolutionService {
    @Autowired
    SolutionMapper solMapper;
    @Autowired
    SolutionDao solDao;

    public List<Solution> selectSolution(Integer deptId,Integer vague,String content){
        return  solMapper.selectSolution(deptId,vague,content);
    }

    public List<Solution> selectSolutionByOppId(Integer oppId){
        return solMapper.selectSolutionByOppId(oppId);
    }

    @Transactional(transactionManager = "transactionManager")
    public void saveSolution(Solution solution){
        solDao.save(solution);
    }

    @Transactional(transactionManager = "transactionManager")
    public void deleteSolution(Integer solutionId){
        solDao.deleteById(solutionId);
    }
}
